<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>windows</title>
<script language="javascript">
function _onload(){
	
	alert("Loading.....");
	str1=document.getElementById("text1");
}
function _beforonunload(){
	if(window.confirm("真的要離開嗎？")){
		alert("ByeBye....TOT");
		return true;
	}
	else{
		return false;
	}
}
function _text1Focus(){
	str1.value="";	
}
function _text1Blur(){
	if(str1.value==""){
		str1.value="XXX@XXX.com";
	}
}
function _size(x,y)
{
	self.resizeTo(y,x);
	self.resizeBy(x,y);
}
function _openNew(){
	window.open("http://www.google.com.hk","Google");
}
function _close(){
	this.window.close();
}
var str1;

</script>
</head>

<body onload="_onload()" onunload="" onbeforeunload="return _beforonunload()">
<form>
<div>
邮箱地址：<input type="text" id="text1" value="XXX@XXX.com" onfocus="_text1Focus()" onblur="_text1Blur()"/><br />
窗口变化:
<input type="button" id="bt1" value="点我" onclick="_size(10,100)" /><br />
打开新窗口：
<input type="button" id="bt2" value="打开新窗口" onclick="_openNew()" /><br />
关闭：
<input type="button" id="bt3" value="关闭" onclick="_close()" />
</div>
</form>
</body>
</html>
